package cn.ybk.basic.controller;


import cn.ybk.basic.dto.PhoneDto;
import cn.ybk.basic.dto.phoneRegisterFormDto;
import cn.ybk.basic.service.PhoneCodeService;
import cn.ybk.basic.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/PhoneCode")
public class PhoneCodeController {

    @Autowired
    private PhoneCodeService phoneCodeService;


    // 发送短信验证
    @PostMapping("/smsCode")
    public AjaxResult smsCode(@RequestBody @Valid  phoneRegisterFormDto dto) {
        phoneCodeService.smsCode(dto);
        return AjaxResult.me().success();
    }


    // 点击注册
    @PostMapping("/phoneRegister")
    public AjaxResult phoneRegister(@RequestBody @Valid PhoneDto dto) {
        phoneCodeService.phoneRegister(dto);
        return AjaxResult.me().success();
    }


}
